package ru.msu.phys.cmp.mpga.domain.image;

import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_highgui.*;
import static com.googlecode.javacv.cpp.opencv_imgproc.*;


import com.googlecode.javacv.CanvasFrame;
 
public class TestImage {
  
    public static void main(String[] args) {
        
        IplImage iploriginal = cvLoadImage("sourceimage.jpg");
        IplImage srcimg = IplImage.create(iploriginal.width(),iploriginal.height(), IPL_DEPTH_8U, 1);
        IplImage destimg  = IplImage.create(srcimg.width(),srcimg.height(), srcimg.depth(), 1);
        cvCvtColor(iploriginal, srcimg, CV_BGR2GRAY);
        cvSobel(srcimg, destimg,0,1,3);        

        
        //create canvas frame named 'Demo'
        final CanvasFrame canvas = new CanvasFrame("Demo");
        //Show image in canvas frame
        canvas.showImage(destimg);
        
        canvas.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
        //This will close canvas frame on exit
    }    
}